#!/bin/sh
#
# 'stop' - Shell script a la RedHat initialization routines

if [ "$1" = "" ]
 then
  BASE=/applications/assp;
 else
  BASE=$1;
fi
export BASE
pidfile=$BASE/pid
echo Stopping ASSP with PID `cat $pidfile` in $BASE

password=$BASE/password.txt

echo `cat $password` | sudo -S kill `cat $pidfile`

sleep 3

echo Restarting ASSP Anti-SPAM Proxy server in $BASE

trap '' 1
LANG=
export LANG
echo `cat $password` | sudo -S perl $BASE/assp.pl $BASE


if [ `cat $pidfile`  ]
	then 
	echo -e "\n"
	echo ASSP is running with PID `cat $pidfile`
fi
